#include <iostream>
#include <string>
#include <vector>
std::string select_delect(std::string str, char c) {

  std::string result;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] != c) {
      result += str[i];
    }
  }
  return result;
}
void copy_string(const std::string &src, std::string &copy) {
  copy.resize(src.size());
  auto src_ptr = src.begin();
  auto copy_ptr = copy.begin();
  while (src_ptr != src.end()) {
    *copy_ptr = *src_ptr;
    src_ptr++;
    copy_ptr++;
  }
}
void set_code(std::vector<std::string> &vec) {
  std::cout << "please input the code:" << std::endl;
  std::string temp;
  std::cin >> temp;
  vec.push_back(temp);
}
void check_code(std::vector<std::string> &vec) {
  std::cout << "please input the code:" << std::endl;
  std::string temp;
  std::cin >> temp;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] == temp) {
      std::cout << "the code is correct!" << std::endl;
      return;
    }
  }
  std::cout << "the code is incorrect!" << std::endl;
}
void swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}
int main() {
//   std::string str;
//   std::cout << "please input a string:" << std::endl;
//   std::cin >> str;
//   std::cout << "please input a char:" << std::endl;
//   char c;
//   std::cin >> c;
//   std::cout << "the result of select_delect is:" << select_delect(str, c)
//             << std::endl;
std::string src = "hello world";std :: string copy;
  copy_string(src, copy);
  std::cout << "the copy of " << src << " is " << copy << std::endl;
  std::vector<std::string> vec;
  set_code(vec);
  check_code(vec);
  int a = 10, b = 20;
  std::cout << "before swap, a = " << a << ", b = " << b << std::endl;
  swap(&a, &b);
  std::cout << "after swap, a = " << a << ", b = " << b << std::endl;
  return 0;
}
